using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum WallNutState
{
    Idel,
    State1,
    State2
}
public class WallNut : PlantBase
{
    WallNutState currentState;


    public WallNutState CurrentState { get => currentState; 
        
        set {
            currentState = value;
            switch (value)
            {
                case WallNutState.Idel:
                    print(33);
                    animator.Play("WallNut_Idel",0,animator.GetCurrentAnimatorStateInfo(0).normalizedTime);
                    break;
                case WallNutState.State1:
                    print(11);
                    animator.Play("WallNut_State1", 0, animator.GetCurrentAnimatorStateInfo(0).normalizedTime);
                    break;
                case WallNutState.State2:
                    print(22);
                    animator.Play("WallNut_State2", 0, animator.GetCurrentAnimatorStateInfo(0).normalizedTime);
                    break;
                default:
                    break;
            }
        }
    }

    void Start()
    {
        Hp = 4000;
        CurrentState = WallNutState.Idel;
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    public override void HpUpdateAction()
    {
        base.HpUpdateAction();
        if (Hp < MaxHp * 2 / 3)
        {
            print(1);
            CurrentState = WallNutState.State1;
        }
        else if (Hp < MaxHp * 1 / 3)
        {
            print(2);
            CurrentState = WallNutState.State2;
        }
        else
        {
            print(3);
            CurrentState = WallNutState.Idel;
        }
    }
}
